package com.cinema.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;


@Mapper
public interface ChartMapper {

    //教练和负责课程的数量
    //Coach   Course
    @Select("select hall.hall_category as category,count(*) as hallCount from Hall group by hall.hall_category")
    List<HashMap> chartA();
    @Select("select mc.movie_category_name as category,count(*) as count from movie_to_category mtc join movie_category mc on mtc.movie_category_id = mc.movie_category_id group by category")
    List<HashMap> chartB();
    @Select("select movie_name as name, movie_box_office as num from movie where del_state = 0 order by num desc")
    List<HashMap> chartC();
    @Select("select case sex when 0 then '女' when 1 then '男' else '未知' end as gender, count(*) as count from user group by sex;")
    List<HashMap> chartD();
    @Select("select date_format(release_date, '%Y') as year, date_format(release_date, '%m') as month, count(*) as count from movie group by year, month order by year asc, month asc;")
    List<HashMap> chartE();

}
